<template>
<div class="Equ_table" >
  <div class="FormExa_sel">
      <div class="FormExa_sel_1">
        <select>
          <option value ="1_1">实验室借用表</option>
          <option value ="1_2">开放实验室借用表</option>
          <option value="1_3">设备借用表</option>
          <option value="1_4">实验室运行记录表</option>
        </select>
     </div>
      <div class="FormExa_sel_2">
          <select>
            <option value="2_1">全部</option>
            <option value ="2_2">已通过</option>
            <option value ="2_3">未通过</option>
            <option value="2_4">未审批</option>
          </select>
      </div>
  </div>
  
  <el-table :data="tableData" style="width: 100%">
    <el-table-column label="编号"  align="center" >
      <template slot-scope="scope">
        <span style="margin-left: 10px">{{ scope.row.id }}</span>
      </template>
    </el-table-column>

    <el-table-column label="表单名称" align="center" >
      <template slot-scope="scope">
        <span style="margin-left: 10px">{{ scope.row.name }}</span>
      </template>
    </el-table-column>

    <el-table-column label="申请日期" align="center">
      <template slot-scope="scope">
        <i class="el-icon-time"></i>
        <span style="margin-left: 10px">{{ scope.row.date }}</span>
      </template>
    </el-table-column>

     <el-table-column label="当前状态" align="center"
     >
      <template slot-scope="scope">
        <i class="el-icon-time"></i>
        <span style="margin-left: 10px">{{ scope.row.status }}</span>
      </template>
    </el-table-column>

     <el-table-column label="操作" width="250%" align="center">
      <template slot-scope="scope">
        <el-button :disabled="scope.row.disabled" size="mini" type="primary" @click="open">查看</el-button>
        </template>
    </el-table-column>
    
  </el-table>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4" :page-sizes="[100, 200, 300, 400]" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="400">
    </el-pagination>
  </div>
</template>

<script>
export default {
     data() {
      return {
        // 搜索
        restaurants: [],
        state: '',
        timeout:  null,

      // 表单
         tableData: [{
          id:'1',
          name: '物理',
          date: '2016-05-02',
          status: ['未通过','已通过','未审批']
        }, {
          id:'2',
          name: '物理',
          date: '2016-05-02',
          status: ['未通过','已通过','未审批']
        }, ],
      };
    },
    methods: {
      // 弹框
      open() {
        
        this.$confirm('该步骤将修改表单状态，请小心使用！', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
          
        }).then(() => {
          this.$message({
            type: 'success',
            message: '通过成功!',
            

          });
           
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });          
        });
      },

      // 表单
      handleEdit(index, row) {
        console.log(index, row);
      },
      handleDelete(index, row) {
        console.log(index, row);
      },

      // 搜索
      loadAll() {
        return [
         { "value": "速记黄焖鸡米饭", "address": "上海市长宁区北新泾街道金钟路180号1层01号摊位" },
          { "value": "红辣椒麻辣烫", "address": "上海市长宁区天山西路492号" },
          { "value": "(小杨生煎)西郊百联餐厅", "address": "长宁区仙霞西路88号百联2楼" },
          { "value": "阳阳麻辣烫", "address": "天山西路389号" },
          { "value": "南拳妈妈龙虾盖浇饭", "address": "普陀区金沙江路1699号鑫乐惠美食广场A13" }
        ];
      },
      querySearchAsync(queryString, cb) {
        var restaurants = this.restaurants;
        var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;

        clearTimeout(this.timeout);
        this.timeout = setTimeout(() => {
          cb(results);
        }, 3000 * Math.random());
      },
      createStateFilter(queryString) {
        return (state) => {
          return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
        };
      },
      handleSelect(item) {
        console.log(item);
      }
    },
    mounted() {
      this.restaurants = this.loadAll();
    },
   
    }
  
</script>

<style scoped>
.Equ_table {
  position: relative;
  height: 100%;
  background-color: #fff;
} 
.el-table-column {
  background-color: rgb(201, 29, 29);
}
.el-row {
  display: inline-block;
  margin-left: 20px;
}
.el-autocomplete {
  display: inline-block;
  margin-left: -800px;
  margin-bottom: 20px;
  margin-top: 20px;
}
.el-pagination
 {
  margin-top: 40%;
}
.FormExa_sel {
  float: left;
  margin-top: 2%;
  margin-left: 3%;
}
.FormExa_sel_1 ,
.FormExa_sel_2
{
  
  display: inline-block;
  margin-right: 20px;
}
select {
  width: 130px;
  
  height: 30px;
}
 
</style>